package de.gameduell.net.src.message {
	import flash.events.EventDispatcher;
	
	import de.gameduell.net.src.body.IBody;
	import de.gameduell.net.src.header.IHeader;	

	/**
	 * @author GD
	 */
	public class Message_V2 extends EventDispatcher implements IMessage {

		private var _header:IHeader;
		private var _body:IBody;

		public function Message_V2(aHeader:IHeader,aBody:IBody) {
			_header  = aHeader;
			_body    = aBody;
		}
		
		public function set parameters(aParameters:Array):void{
			_body.parameters = aParameters;
		}

		public function get id():int {
			return _header.id;
		}
		
		public function set id(aId:int):void {
			_header.id = aId;
		}
		
		public function get encryptedContent():String {
			return _header.content + _body.encryptedContent;
		}
		
		public function get content():String{
			return _header.content + _body.content;
		}
		
		public function get body():IBody {
			return _body;
		}
		
		public function get header():IHeader {
			return _header;
		}
		
		public function get requestType():String {
			return _body.requestType;
		}
		
		public function get parameters():Array {
			return _body.parameters;
		}
		
		public function equals(message:IMessage):Boolean {
			return message.id == _header.id;
		}
		
		
		

	}
}
